//package club.baimahu.pencil.miaosha.rocketmq;
//
//import club.baimahu.pencil.miaosha.service.IdWorkerService;
//import club.baimahu.pencil.miaosha.service.StockService;
//import lombok.extern.slf4j.Slf4j;
//import org.apache.rocketmq.client.producer.TransactionSendResult;
//import org.apache.rocketmq.spring.core.RocketMQTemplate;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.beans.factory.annotation.Value;
//import org.springframework.messaging.Message;
//import org.springframework.messaging.support.MessageBuilder;
//import org.springframework.stereotype.Service;
//
///**
// * TODO
// *
// * @author zhanghongjiang
// * @version 1.0
// * @date 2021/9/17 15:34
// */
//
//@Slf4j
//@Service
//public class RocketProducerService {
//
//    @Autowired
//    private RocketMQTemplate rocketMQTemplate;
//
//    @Autowired
//    IdWorkerService idWorkerService;
//
//    @Value("${rocketmq.producer.group}")
//    private String producerGroup;
//
//    public void sendMessage(String msg, String keys , String topic, String tag){
//        log.info("【发送消息】：{}", msg);
//        Message message = MessageBuilder.withPayload(msg).setHeader("KEYS",keys).build();
//        //TransactionSendResult result = rocketMQTemplate.sendMessageInTransaction(StockService.CREATE_STOCK_ORDER_TOPIC + ":*", message,null);
//        rocketMQTemplate.send(topic + ":" + tag ,message);
//    }
//}
